<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/24 0024
  Time: 下午 4:39
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>编辑</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">
</head>
<body>
<div class="box-padding-15">
    <form class="layui-form" action="/dept/update" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">店门编号</label>
            <div class="layui-input-block">
                <input type="hidden" name="id" id="id" value="${dept.id}">
                <input type="hidden" name="inCity" id="id1" value="${dept.inCity}">
                <input type="hidden" name="gpslon" id="id2" value="${dept.gpslon}">
                <input type="hidden" name="gpslat" id="id3" value="${dept.gpslat}">
                <input type="hidden" name="remark" id="id4" value="${dept.remark}">
                <input type="text" name="deptId" value="${dept.deptId}"  lay-verify="required|deptId" placeholder="请输入店门编号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">门店名</label>
            <div class="layui-input-block">
                <input type="text" name="deptName"  value="${dept.deptName}"  lay-verify="required" placeholder="请输入门店名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">门店固话</label>
            <div class="layui-input-block">
                <input type="text" name="deptPhone"  value="${dept.deptPhone}"  lay-verify="required" placeholder="请输入门店固话" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">店长姓名</label>
            <div class="layui-input-block">
                <input type="text" name="ownerName"  value="${dept.ownerName}"  lay-verify="required" placeholder="请输入店长姓名" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">店长电话</label>
            <div class="layui-input-block">
                <input type="text" name="ownerMobile"  value="${dept.ownerMobile}"  lay-verify="required" placeholder="请输入店长电话" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">详细地址</label>
            <div class="layui-input-block">
                <input type="text" name="address"  value="${dept.address}"  lay-verify="required" placeholder="请输入详细地址" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
                <a href="/dept"><button type="button" class="layui-btn layui-btn-primary" id="cancel">取消</button></a>
            </div>
        </div>
    </form>
</div>

<script src="/static/plugins/jquery.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script src="/static/js/common.js"></script>
<script>

    layui.use(['element','layer','form','upload'], function(){
        var form = layui.form
            ,upload = layui.upload
            ,element = layui.element
            ,layer = layui.layer;

        //监听提交
        form.on('submit(formSubmit)', function(data){
            //进行异步保存
            $.ajax({
                url: "/dept/update",
                type:"post",
                data:data.field,
                dataType:'json',
                success:function(rs){
                    layer.msg(rs.message,{time:1000},function () {
                        if(rs.code == 1) {
                            parent.$("#tb_page").bootstrapTable("refresh");  //刷新表格数据
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        }
                    });

                },
                error:function(){
                    layer.msg("服务器忙，请稍后再试！");
                }
            });
            return false;
        });
    });
    $("#cancel").on('click',function (e) {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    })

</script>
</body>
</html>
